//当前模块，API进行统一管理，即对请求接口统一管理
import requests from "@/api/ajax";

//首页三级分类接口
export const getUserList = () => {
    return requests({
        url: '/user/usersList',
        method: 'GET'
    })
}

export const inserUser = (userName, password, role, name, sex, address) => {
    return requests({
        url: `/user/register/${userName}/${password}/${role}/${name}/${sex}/${address}`,
        method: 'POST',
    })
}

export const getCourseList = ()=>{
    return requests({
        url:`/course/courseList`,
        method:'GET',
    })
}

export const deleteCourse = (id) => {
    return requests({
        url:`/course/delete/${id}`,
        method:'DELETE',
    })
}

export const updateCourse = (courseTime,courseNumber,courseHour,id) => {
    return requests({
        url:`/course/update/${courseTime}/${courseNumber}/${courseHour}/${id}`,
        method:'POST',
    })
}

export const getClassList=() =>{
    return requests({
        url:`/class/classList`,
        method:'GET',
    })
}

export const deleteClass = (id) => {
    return requests({
        url:`/class/delete/${id}`,
        method:'DELETE',
    })
}

export const updateClass = (className,classType,classNumber,id) => {
    return requests({
        url:`/class/update/${className}/${classType}/${classNumber}/${id}`,
        method:'POST',
    })
}

export const getSubjectList=() =>{
    return requests({
        url:`/subject/subjectList`,
        method:'GET',
    })
}

export const deleteSubject = (id) => {
    return requests({
        url:`/subject/delete/${id}`,
        method:'DELETE',
    })
}

export const updateSubject = (subjectName,subjectInfo,credit,id) => {
    return requests({
        url:`/subject/update/${subjectName}/${subjectInfo}/${credit}/${id}`,
        method:'POST',
    })
}